package com.wzcl.app.controller;


import com.wzcl.app.dao.model.Provinces;
import com.wzcl.app.model.common.RVO;
import com.wzcl.app.model.dto.ProvinceDto;
import com.wzcl.app.service.ProvinceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Log4j2
@RestController
@RequestMapping("/province")
@Api(value = "省份相关controller", tags = {"省份相关接口"})
public class ProvincesController {
    @Resource
    private ProvinceService provinceService;

    @ApiOperation("查找城市")
    @PostMapping("/query")
    public RVO getCity(@RequestBody ProvinceDto provinceDto){
        List<Provinces> provincesList = provinceService.getProvincesList(provinceDto);
        return RVO.success(provincesList);
    }
}
